/** 
    @file frame_listener.hpp
    @brief Frame Listener Class
*/

#ifndef FRAME_LISTENER_HPP
#define FRAME_LISTENER_HPP

#include "pixel/pixelworld.hpp"
#include "hud/text_overlay.hpp"
#include "physics.hpp"

#include <Ogre.h>

#include <QKeyEvent>

#include <map>

namespace pm3 {
    /**
        @class FRAME_LISTENER
        @brief The Frame Listener Class
    */
    class FRAME_LISTENER: public Ogre::FrameListener {
	public:
        /**
            @brief Constructor
        */
        FRAME_LISTENER();
        /**
            @brief Destructor
        */
        ~FRAME_LISTENER();

        /**
            @brief Override function for the FrameStarted event
            @param[in] r_event Reference to Ogre FrameEvent
            @return False if the application should be closed and True, when the application should keep on running
        */
        bool frameStarted( const Ogre::FrameEvent &r_event );

        /**
            @brief Override function for the FrameEnded event
            @param[in] f_event Reference to Ogre FrameEvent
            @return False if the application should be closed and True, when the application should keep on running
        */
        bool frameEnded( const Ogre::FrameEvent &f_event );

        //! A map for checking if keys are up or down
        std::map< long, bool > m_keymap;

        //! Old position of the mouse
        Ogre::Vector2 m_mouse_old_pos;
        //! New position of the mouse
        Ogre::Vector2 m_mouse_new_pos;
        //! Mouse state
        long m_mouse_state;

	private:
        //! A timer counter
        Ogre::Real m_time;
    };

}

#endif
